import React, {Component} from "react";
import About from "./pages/About";
import Home from "./pages/Home";

import MyNavLink from "./components/MyNavLink";
import {Route, Switch} from "react-router-dom";


export default class App extends Component {

    render() {
        return (
            <div>
                <div className="row">
                    <div className="col-xs-offset-2 col-xs-8">
                        <div className="page-header"><h2>React Router Demo</h2></div>
                    </div>
                </div>
                <div className="row">
                    <div className="col-xs-2 col-xs-offset-2">
                        <div className="list-group">
                            <MyNavLink to="/AAA/about" className="list-group-item" children="About"></MyNavLink>
                            <MyNavLink to="/AAA/home" className="list-group-item" children="Home"></MyNavLink>
                        </div>
                    </div>
                    <Switch>
                        {/*
                        解决多级路径刷新页面样式丢失的问题
                         1.public/index.html 中引入样式时不写 ./写/(常用)
                         2.public/index.html 中引入样式时不写./ 号 %PUBLIC URL%(常用)
                         3.使用HashRouter
                        */}
                        <Route path="/AAA/about" component={About}/>
                        <Route path="/AAA/home" component={Home}/>
                    </Switch>
                </div>
            </div>


        )
    }
}